aux_source_directory(. APP_SOURCES)
add_executable(${PROJECT_NAME} ${APP_SOURCES})

target_link_libraries(${PROJECT_NAME} PRIVATE
    ${util_lib_name}
    fmt::fmt
    spdlog::spdlog
)

set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${bin_dir})
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "\${ORIGIN}/../lib")

# 构建后动作
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD

    # 复制启动脚本
    COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/resources/${PROJECT_NAME} ${sbin_dir}/${PROJECT_NAME}

    # 复制动态库文件
    COMMAND cp -rp ${fmt_DIRECTORY}/lib* ${lib_dir}
    COMMAND cp -rp ${spdlog_DIRECTORY}/lib* ${lib_dir}
)